package Chapter06;

/**
 * 新建无返回值的线程
 *
 * Created by a on 2017/6/11.
 */
public class Test123 {
    public static void main(String[] args) {

        System.out.println("========单线程=========");

        StringBuilder sb = new StringBuilder();
        for (int i = 0;i < 5; i++){
            sb.append("<JavaB编程词典>\n");
        }
        for (int i = 0;i < 5; i++){
            sb.append("<视频学Java>\n");
        }
        System.out.println(sb.toString());

        System.out.println("========多线程=========");

        final StringBuilder sb1 = new StringBuilder();
        for (int i = 0; i < 5; i++){
            new Thread(){
                @Override
                public void run() {
                    sb1.append("《Java编程词典》\n");
                }
            }.start();
        }

        for (int i = 0; i < 5; i++){
            new Thread(){
                @Override
                public void run() {
                    sb1.append("《视频学Java》\n");
                }
            }.start();
        }

        System.out.println(sb1.toString());


    }
}
